
 ** INTERMEDIATE OUTCOMES **

/*Baseline*/

index_maker , indexname(uncens_fam_asb) indexlab("Family: ASB") inputvars(asbhostil disputes_all_z carryweapon drugssellever stealnb arrested ) ///
               suffix(b) operation(mean) recenter
index_maker , indexname(fam_asb) indexlab("Family: ASB") inputvars(asbhostil cens_disputes_all_z carryweapon drugssellever stealnb arrested ) ///
               suffix(b) operation(mean) recenter
index_maker , indexname(cens_fam_asb) indexlab("Family: ASB") inputvars(asbhostil cens_disputes_all_z carryweapon drugssellever cens_stealnb arrested ) ///
               suffix(b) operation(mean) recenter



index_maker , indexname(success) indexlab("Index of Economic Success (without consumption)") inputvars(profitsump99avg7d wealth_indexstd ) ///
               suffix(b) operation(mean) recenter
index_maker , indexname(sctp) indexlab("Summary index of self control and time preferences at baseline, Z") inputvars(personalitystd timedecl) ///
              suffix(b) operation(mean) recenter

/*Endline*/


        // b. STANDARDIZE COEFFICIENTS

            foreach x in grassever grassdailyuser  harddrugsever harddrugsdailyuser drugssellever steals_felony  steals peerquality asb hostility asbhostil_z_p houravg7d illicit7dhrsavg formal7dhrsavg informal7dhrsavg patient_game_real incon_game_real profitsump99avg7d bizexptot bizstocktot cstot2wusd disputes_serious_all   risk_game_real stealnb savstock sleepstreet2wdys cshealthedu2wusd csfood3dusd csnonfood2wusd{
                local lbl : variable label `x'_e
                qui egen `x'std_e = std(`x'_e)
                qui replace `x'std_e=. if `x'_e==.
                qui la var `x'std_e "`lbl' (Z-Score)"
            }

            foreach x in grassever grassdailyuser  harddrugsever harddrugsdailyuser drugssellever steals_felony  steals peerquality asb hostility  patient_game_real stealnb risk_game_real  incon_game_real cashsumprofit4wp99 {
                local lbl : variable label `x'_b
                qui egen `x'std_b = std(`x'_b)
                qui replace `x'std_b=. if `x'_b==.
                qui la var `x'std_b "`lbl' (Z-Score)"

            }


index_maker , indexname(prosocial) indexlab("Prosocial behavior index (no trust), Z-score") inputvars(groups groupleadindex publicgoodcontrnumb  ) ///
               suffix(e) operation(mean) recenter
index_maker , indexname(prosocialindex) indexlab("Prosocial behavior index, Z-score") inputvars(groups groupleadindex publicgoodcontrnumb trustindex ) ///
               suffix(e) operation(mean) recenter  keepstd(yes)
index_maker , indexname(wellbeing) indexlab("Well-being index, Z-score") inputvars(laddernow subwellbeing relwellbeing ) ///
               suffix(e) operation(mean) recenter  keepstd(yes)
index_maker , indexname(appearanceindex) indexlab("Standardized index of appearance at endline") inputvars(shoecond_resc breath_resc clothescond_resc cleanface_resc hair_resc fingernails_resc ) ///
               suffix(e) operation(mean) recenter  keepstd(yes)
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality") inputvars(attviolence attcriminality politicalviol) ///
              suffix(e) operation(mean) recenter keepstd(yes)


index_maker , indexname(fam_econ) indexlab("Economic Performance") inputvars(profitsump99avg7d wealth_indexstd cstot2wusd savstockp99 homeless bizexptotp99 bizstocktotp99 houravg7d ) ///
               suffix(e) operation(mean) recenter rescale(homeless)   keepstd(yes)


index_maker , indexname(fam_asb) indexlab("Antisocial behaviors") inputvars(asbhostil_z_p cens_disputes_all_z_p carryweapon drugssellever stealnb arrested domabuse_z_p) ///
               suffix(e) operation(mean) recenter keepstd(yes)
index_maker , indexname(cens_fam_asb) indexlab("Antisocial behaviors") inputvars(asbhostil_z_p cens_disputes_all_z_p carryweapon drugssellever cens_stealnb arrested domabuse_z_p ) ///
               suffix(e) operation(mean) recenter keepstd(yes)


index_maker , indexname(cens_fam_asb_ksf) indexlab("Antisocial behaviors") inputvars(asbhostil_z_k cens_disputes_all_z_k carryweapon drugssellever cens_stealnb arrested domabuse_z_k) ///
               suffix(e) operation(mean) recenter keepstd(yes)
index_maker , indexname(cens_fam_asb_ss) indexlab("Antisocial behaviors") inputvars(asbhostil_z_ss cens_disputes_all_z_ss carryweapon drugssellever cens_stealnb arrested domabuse_z_ss) ///
               suffix(e) operation(mean) recenter keepstd(yes)




index_maker , indexname(fam_network) indexlab("Family Index: Quality of social networks") inputvars(peerqualitystd famsupportindex patronlvl rel_commanders) ///
              suffix(e) operation(mean) recenter keepstd(yes)
index_maker , indexname(fam_mental) indexlab("Family Index: Mental health") inputvars(neuroticstd selfesteemstd wellbeing locuscontrstd depression distress) ///
              suffix(e) operation(mean) recenter rescale(neuroticstd depression distress)
index_maker , indexname(fam_identity) indexlab("Family Index: Mental health") inputvars(attviolence attcriminality politicalviol appearanceindex prosocialindex) ///
              suffix(e) operation(mean) recenter rescale(attviolence attcriminality politicalviol)
index_maker , indexname(timepref) indexlab("Summary index of forward looking preferences, Z") inputvars(timedecl_p patient_game_real patient_game_decl patient_rate_dsct timedecl_t incon_game_real incon_game_decl incon_rate_dsct) ///
              suffix(e) operation(mean) recenter rescale(incon_game_real incon_game_decl incon_rate_dsct) keepstd(yes)
index_maker , indexname(selfcontrolnolo) indexlab("Index of self control skills") inputvars(impulsivestd_resc rewardrespstd_resc conscientiousstd gritstd) ///
              suffix(e) operation(mean) recenter
index_maker , indexname(fam_subabuse) indexlab("Substance Abuse") inputvars(drinkboozeever grassever harddrugsever) ///
              suffix(e) operation(mean) recenter
index_maker , indexname(mech_allexceptef) indexlab("Summary index of mechanisms, TP + SC + ID + 3") inputvars(timepref selfcontrolnolo fam_identity fam_mental subabuse fam_network) ///
              suffix(e) operation(mean) recenter rescale(subabuse)


/*Sub divided indexes*/

index_maker , indexname(success) indexlab("Index of Economic Success") inputvars(profitsump99avg7d  cstot2wusd wealth_indexstd ) ///
               suffix(e) operation(mean) recenter

index_maker , indexname(fam_mental_pos) indexlab("Family Index: Mental health - Positive Selfregard") inputvars(neuroticstd selfesteemstd wellbeing locuscontrstd) ///
              suffix(e) operation(mean) recenter rescale(neuroticstd)
index_maker , indexname(fam_mental_dep) indexlab("Family Index: Mental health - Depression") inputvars(depression distress) ///
              suffix(e) operation(mean) recenter

index_maker , indexname(timepref_p) indexlab("Summary index of patience, Z") inputvars(timedecl_p patient_game_real patient_game_decl patient_rate_dsct) ///
              suffix(e) operation(mean) recenter
index_maker , indexname(timepref_t) indexlab("Summary index of time consistency, Z") inputvars(timedecl_t incon_game_real incon_game_decl incon_rate_dsct) ///
              suffix(e) operation(mean) recenter rescale(incon_game_real incon_game_decl incon_rate_dsct) /*More is more consistent*/
index_maker , indexname(timepref_real) indexlab("Summary index of real time preferences, Z") inputvars( patient_game_real incon_game_real) ///
              suffix(e) operation(mean) recenter rescale(incon_game_real)

index_maker , indexname(sctp) indexlab("Self Control with Time Preferences") inputvars(personalitystd timepref) ///
              suffix(e) operation(mean) recenter
index_maker , indexname(scef) indexlab("Self Control with Executive Function") inputvars(personalitystd ef_score) ///
              suffix(e) operation(mean) recenter
index_maker , indexname(sctpef) indexlab("Self Control with Time Preferences and Executive Function") inputvars(personalitystd timepref ef_score) ///
              suffix(e) operation(mean) recenter

/*Enphasis components*/

index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis g1)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(g1_e) operation(mean) recenter
index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis g1.5)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(g15_e) operation(mean) recenter
index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis g2)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(g2_e) operation(mean) recenter

index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis le1)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(le1_e) operation(mean) recenter
index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis le1.5)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(le15_e) operation(mean) recenter
index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis le2)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(le2_e) operation(mean) recenter

/**/
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis g1)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(g1_e) operation(mean) recenter
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis g1.5)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(g15_e) operation(mean) recenter
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis g2)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(g2_e) operation(mean) recenter

index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis le1)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(le1_e) operation(mean) recenter
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis le1.5)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(le15_e) operation(mean) recenter
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis le2)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(le2_e) operation(mean) recenter

/**/
index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis g1)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(g1_e) operation(mean) recenter rescale(impulsive rewardresp)
index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis g1.5)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(g15_e) operation(mean) recenter rescale(impulsive rewardresp)
index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis g2)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(g2_e) operation(mean) recenter rescale(impulsive rewardresp)

index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis le1)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(le1_e) operation(mean) recenter rescale(impulsive rewardresp)
index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis le1.5)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(le15_e) operation(mean) recenter rescale(impulsive rewardresp)
index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis le2)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(le2_e) operation(mean) recenter rescale(impulsive rewardresp)


/*
project_labeling *, suffix(e)

indent_varlabel, varstoindent(impulsivestd conscientiousstd gritstd rewardrespstd ///
                              timepref_p timepref_t timepref_real fam_mental_pos  ///
                              fam_mental_dep wellbeing peerqualitystd famsupportindex ///
                              drugssellever stealnb disputes_all_z carryweapon arrested asbhostil domabuse_z ///
                              rel_commanders patronlvl violatt appearanceindex  prosocial)  indenttimes(1) suffix(e)

indent_varlabel, varstoindent(neuroticstd locuscontrstd selfesteemstd depression distress laddernow subwellbeing relwellbeing  ///
                 groups groupleadindex publicgoodcontrnumb trustindex attviolence attcriminality politicalviol) indenttimes(2) suffix(e)

indent_varlabel, varstoindent(stealtakethingsx stealmistakecorrx stealscrapex stealpickpocketx stealscamx stealblackdeedx stealmuggerx stealarmedrobx ///
                fightsmlneigh fightbigneigh fightphys fightweapon fightsmlleader fightbigleader fightsmlpolice fightbigpolice fine ///
                badreact_resc badadvice_resc hardjokes_resc baddestroy_resc cheat_resc troublesome_resc frustrated_resc threaten_resc takethings_resc selfdiscipline_resc ///
                asb_reactlose_resc asb_reacthit_resc asb_reactdefend_resc asb_reacttease_resc asb_proontop_resc asb_provandalize_resc asb_procompetitor_resc asb_prophysforce_resc asb_procuss_resc ///
                maccuse_resc mthreat_resc minsult_resc mhit_resc  ///
                nvstrangerrob nvowetakesthg nvknowncriminal nvstorekeeperpunish_resc nvkillstore_resc nvbeatwoman nvdestroyproperty nvstealfriendsgirl nvcorruptleaderbeaten nvbeatwife nvgirlrape ///
                attstchinamanbeat attstblackmoney attstnightops_resc attsttaxiwallet attstmoneydroptake attstfamilylec attstmoneybagtake attstmoneyhangtake attstroomvaluablestake attselfdrugsell attstknownindiv attstifreturn ///
                pvhypdemstpaid pvhyppalpaid pvhyppalpaid200ld pvhypdemstpaidwcheat pvhyppalpaidwcheat pvhyppalpaid200ldwcheat ///
                clothescond_resc shoecond_resc breath_resc cleanface_resc hair_resc fingernails_resc ///
                leader bigman groupcommleader startgroup_resc ///
                trustrelatives_resc trusttleader_resc trustngos_resc trustipal_resc ///
                nrtc_sad_resc nrtc_worry_resc nrtc_threaten_resc nrtc_offend_resc nrtc_stress_resc nrtc_disturb_resc nrtc_relax_resc nrtc_bother_resc ///
                lc_choicesfuture_resc lc_nocontrol_resc lc_bizluck_resc lc_tryhard_resc lc_planswork_resc lc_badluck_resc lc_peoplestreets_resc lc_success_resc ///
                se_satisfied_resc se_useless_resc se_fail_resc se_respect_resc se_goodperson_resc se_good4nothing_resc se_bizwell_resc se_notproud_resc ///
                baddo_resc badhear_resc badsad_resc badtired_resc badeat_resc badimportant_resc  ///
                thinkbad_resc baddream_resc badagain_resc badbody_resc badaway_resc badspoiled_resc badtalk_resc badfrust_resc badspirit_resc baddry_resc badsat_resc badburn_resc  ///
                happiness satisfaction health ///
                ladderrich ladderresp ladderpower ladderaccess   ///
                drinkboozeever grassever harddrugsever ///
                peerschool peercommmtg peerchurch peerwork peerbusiness peersave peertrust peershare peercheer peerguard peerbeg_resc peerdrunk_resc peerdrugs_resc peerpickpocket_resc peerburglary_resc peerrobbers_resc peergamble_resc peerexcom_resc peercomdr_resc peersmallpal_resc peerbigpal_resc ///
                famseeoften_resc famconcern_resc famadvise_resc famhelp_resc ///
                peercomdr relcomm jobcomm repcomm ///
                ptrnjob ptrnbiz ptrnfood ptrnschl ptrnhsing ///
                time_decl_patienceladder time_decl_patient_resc time_decl_saveproblems_resc ///
                time_decl_spendquick time_decl_celebrate th_avdmnywstingfrnds_resc  ///
                bimpls_buy_resc bimpls_act_resc bimpls_talk_resc bimpls_squirm_resc bimpls_concentrate_resc bimpls_present_resc bimpls_control_resc time_decl_regretspend_resc   ///
                cnsc_prepare_resc cnsc_details_resc cnsc_doitright_resc cnsc_plans_resc cnsc_getby_resc cnsc_work_resc cnsc_complete_resc cnsc_shirk_resc ///
                prsv_overcome_resc prsv_ambitious_resc prsv_discourage_resc prsv_achieveimp_resc prsv_driven_resc prsv_changeplan_resc prsv_achievenoimp_resc   ///
                bas_goallout_resc bas_noholds_resc bas_doforfun_resc bas_keepatit_resc bas_feelexcite_resc bas_seeopp_resc bas_feelstrongly_resc bas_wincontest_resc ///
                ) indenttimes(3) suffix(e)

*/

    // j. Create differences
    foreach v in impulsive conscientious grit rewardresp ///
        neurotic locuscontr selfesteem patient_game_real ///
        incon_game_real risk_game_real asb hostility ///
        disputes_serious_all carryweapon ///
        drugssellever stealnb arrested drinkboozeever grassever harddrugsever       ///
        profitsump99avg7d wealth_indexstd savstockp99       ///
        homeless houravg7d illicit7dhrsavg formal7dhrsavg informal7dhrsavg {
            qui gen `v'_diff = `v'_e - `v'_b
            qui la var `v'_diff "`v': baseline to endline difference"
    }
